import axios from "axios";

export default class HttpUtils {

    static post(json) {
        axios.post('https://datatransfer.lingoace.com/api/v1/data-transfer/3rd/up?key=oQtOLPwTuO8df7dIv9I', json).then((res) => {
            console.log(res);
        }).catch(res=>{
            console.log(res);
            console.log(res.response);
        });
    }

    //
    // private static final MediaType JSON
    //         = MediaType.get("application/json; charset=utf-8");
    //
    // private final static OkHttpClient client = new OkHttpClient();
    //
    // final static String baseUrl = "https://datatransfer.lingoace.com/api/v1/data-transfer/3rd/up?key=oQtOLPwTuO8df7dIv9I";
    //
    // public static void post(String json) {
    //     System.out.println(TAG + "\t" + json);
    //     RequestBody body = RequestBody.create(json, JSON);
    //     Request request = new Request.Builder()
    //             .url(baseUrl)
    //             .post(body)
    //             .build();
    //     client.newCall(request).enqueue(new Callback() {
    //         @Override
    //         public void onFailure(@NonNull Call call, @NonNull IOException e) {
    //             System.out.println(TAG + "\t" + e.getMessage());
    //         }
    //
    //         @Override
    //         public void onResponse(@NonNull Call call, @NonNull Response response) throws IOException {
    //         }
    //     });
    // }
}
